﻿using System.Collections.Generic;
using System.Web.Mvc;
using MvcApplication.Models;

namespace MvcApplication.Controllers
{
    public class CustomerSummaryController : Controller
    {
        //
        // GET: /CustomerSummary/

        public ActionResult Index()
        {
            var summaries = new List<CustomerSummary>
                                {
                                    new CustomerSummary
                                        {
                                            ID="1",
                                            Name = "Frank",
                                            Active = true,
                                            MostRecentOrderDate = "2011-09-26",
                                            OrderCount = "1",
                                            ServiceLevel = "VIP"
                                        },
                                    new CustomerSummary
                                        {
                                            Name = "Jim",
                                            ID="2",
                                            Active = true,
                                            MostRecentOrderDate = "2011-09-27",
                                            OrderCount = "2",
                                            ServiceLevel = "VIP"
                                        },
                                    new CustomerSummary
                                        {
                                            Name = "Anne",
                                            ID="3",
                                            Active = false,
                                            MostRecentOrderDate = "2011-09-28",
                                            OrderCount = "3",
                                            ServiceLevel = "VIP"
                                        }
                                };

            return View(summaries);
        }

        public ActionResult Display()
        {
            var customerSummary = new CustomerSummary
                                      {
                                          ID = "1",
                                          Name = "Frank",
                                          Active = true,
                                          MostRecentOrderDate = "2011-09-26",
                                          OrderCount = "1",
                                          ServiceLevel = "VIP",
                                          Email = "yuxinggao@gmail.com",
                                          ChildrenIDs = new List<string> {"1","2","3"},
                                          Customer = new CustomerInfo {FirstName ="Frank", LastName = "Gao",Active = true}
                                      };
            return View(customerSummary);
        }

        public ActionResult Save(CustomerInfo customer)
        {
            var customerInfo = new CustomerInfo {FirstName = "Frank", LastName = "Gao", Active = true};
            return View(customerInfo);
        }
    }

}
